package edu.xust.dao.impl;

import edu.xust.config.Repository;
import edu.xust.config.Resource;
import edu.xust.dao.UserDao;
import edu.xust.entity.AdminExample;
import edu.xust.entity.User;
import edu.xust.entity.UserExample;
import edu.xust.mapper.UserMapper;
import edu.xust.page.PageInfo;

import java.util.List;
@Repository("userDao")
public class UserDaoImpl implements UserDao {
    @Resource
    UserMapper userMapper;

    @Override
    public List<User> getUserByPage(PageInfo pageInfo) throws Exception {
        UserExample  userExample  =  new UserExample();
        long l = userMapper.countByExample(null);
        pageInfo.setItemCount((int)l);
        userExample.setOffset(pageInfo.getOffset());
        userExample.setLimit(pageInfo.getPageSize());
        return userMapper.selectByExample(userExample);
    }
}
